package com.mskj.zxmy.mapper;

import com.mskj.zxmy.dto.Material;
import com.mskj.zxmy.dto.ProductSelectFo;
import com.mskj.zxmy.dto.ReportInfo;
import com.mskj.zxmy.dto.TaskDto;
import com.mskj.zxmy.entity.*;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface MyTaskMapper {


    TaskDto queryTaskInfoByOPId(@Param("orderId") Integer orderId, @Param("processId") Integer processId);

    int updateStartTime(@Param("processTaskId") Integer processTaskId, @Param("now") LocalDateTime now);

    Map<String,Object> getById(@Param("processTaskId") Integer processTaskId);

    ReportInfo getReportingWorksByPid(@Param("processTaskId") Integer processTaskId);

    List<String> getNickNameByMemberIds(@Param("signInStrList") String signInStrList);

    String getMaxBgSerialNumber(@Param("prefix") String prefix);

    BarcodeManagementTable getBarCode(Integer barCodeId);

    String getCodeById(@Param("barcodeId") Integer barcodeId);

    int updateBarcodeMain(BarcodeManagementTable main);

    int saveBarcodeDetail(BarCodeManagementDetails detail);

    int saveReport(ChecklistSc05 checklistSc05);

    Map<String,Object> getProcessByName(@Param("processName") String processName);

    BarcodeManagementTable getBarCodePoByCode(@Param("batchCode") String batchCode);

    String getBgrs(@Param("processName") String processName);

    List<BarCodeManagementDetails> getActionDetails(@Param("id") Integer id);

    String getMaxBgSerialNumberRk(String prefix);

    int saveRkd(Ck03Listing ck03Listing);

    int saveRkDetail(Ck04ListOfEntriesListOfEntries detail);

    Map<String, Object> getProductById(Integer productId);

    Map<String,Object> getProductTask(@Param("productionTasks") Integer productionTasks);

    String getMaxLLSerialNumber(String prefix);

    int saveLLd(RepositoryApplication repositoryApplication);

    int saveLLdDetail(List<ChecklistForTheCheckout> list);

    List<Material> getProductList(ProductSelectFo fo);

    Long countProductList(ProductSelectFo fo);

    List<Material> getProductListWithPage(@Param("fo") ProductSelectFo fo, @Param("offset") int offset, @Param("pageSize") int pageSize);

    String getMaxBgSerialNumberCK(String prefix);


    // 判断某用户在某工序是否有签到记录
    Integer countSignInRecord(@Param("processName") String processName, @Param("signIn") String signIn);

    // 根据子表数据计算并更新主表的number字段
    int updateBarcodeMainNumber(@Param("barcodeId") Integer barcodeId);

    // 获取子表数据用于计算主表number
    List<BarCodeManagementDetails> getBarcodeDetailsForCalculation(@Param("barcodeId") Integer barcodeId);

}
